<?php

/**
 * This is the model class for table "jumlahproduksiayamtelur".
 *
 * The followings are the available columns in table 'jumlahproduksiayamtelur':
 * @property integer $jpat_id
 * @property integer $jpat_kec
 * @property integer $jpat_ayam
 * @property integer $jpat_telur_produksi
 * @property integer $jpat_telur_berat
 * @property integer $jpat_telur_nilai
 * @property integer $jpat_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jpatKec
 */
class Jumlahproduksiayamtelur extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahproduksiayamtelur the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahproduksiayamtelur';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jpat_kec, jpat_ayam, jpat_telur_produksi, jpat_telur_berat, jpat_telur_nilai, jpat_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jpat_id, jpat_kec, jpat_ayam, jpat_telur_produksi, jpat_telur_berat, jpat_telur_nilai, jpat_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jpatKec' => array(self::BELONGS_TO, 'Kecamatan', 'jpat_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jpat_id' => 'Jpat',
			'jpat_kec' => 'Jpat Kec',
			'jpat_ayam' => 'Jpat Ayam',
			'jpat_telur_produksi' => 'Jpat Telur Produksi',
			'jpat_telur_berat' => 'Jpat Telur Berat',
			'jpat_telur_nilai' => 'Jpat Telur Nilai',
			'jpat_tahun' => 'Jpat Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jpat_id',$this->jpat_id);
		$criteria->compare('jpat_kec',$this->jpat_kec);
		$criteria->compare('jpat_ayam',$this->jpat_ayam);
		$criteria->compare('jpat_telur_produksi',$this->jpat_telur_produksi);
		$criteria->compare('jpat_telur_berat',$this->jpat_telur_berat);
		$criteria->compare('jpat_telur_nilai',$this->jpat_telur_nilai);
		$criteria->compare('jpat_tahun',$this->jpat_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}